<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.org/schema/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui" 
    template="/layout/template.xhtml">

<ui:define name="body">

    <h:form id="questaoSearch" styleClass="edit">

        <p:panel header="Questao Search Filter" switchType="ajax">

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Descricao</ui:define>
                <p:inputText id="descricao" value="#{questaoList.questao.descricao}"/>
            </s:decorate>

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <p:selectOneRadio id="logic" value="#{questaoList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="All" itemValue="and"/>
                    <f:selectItem itemLabel="Any" itemValue="or"/>
                </p:selectOneRadio>
            </s:decorate>

        </p:panel>

        <div class="actionButtons">
            <p:commandButton id="search" value="Search" action="/layout/QuestaoList.xhtml"/>
            <p:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>

    <p:panel>
        <f:facet name="header">Questao Search Results (#{empty questaoList.resultList ? 0 : (questaoList.paginated ? questaoList.resultCount : questaoList.resultList.size)})</f:facet>
    <div class="results" id="questaoList">

    <h:outputText value="The questao search returned no results."
               rendered="#{empty questaoList.resultList}"/>

    <p:dataTable id="questaoList"
                var="_questao"
              value="#{questaoList.resultList}"
           rendered="#{not empty questaoList.resultList}">
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{questaoList}"/>
                    <ui:param name="propertyLabel" value="Id"/>
                    <ui:param name="propertyPath" value="questao.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_questao.id}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{questaoList}"/>
                    <ui:param name="propertyLabel" value="Data criação"/>
                    <ui:param name="propertyPath" value="questao.dataCriacao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_questao.dataCriacao}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{questaoList}"/>
                    <ui:param name="propertyLabel" value="Descricao"/>
                    <ui:param name="propertyPath" value="questao.descricao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_questao.descricao}"/>
        </p:column>
        <p:column styleClass="action">
            <f:facet name="header">Action</f:facet>
            <p:link outcome="/pages/#{empty from ? 'Questao' : from}.xhtml"
                   value="#{empty from ? 'View' : 'Select'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="questaoViewId">
                <f:param name="questaoId"
                        value="#{_questao.id}"/>
            </p:link>
            #{' '}
            <p:link outcome="/pages/QuestaoEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="questaoEdit"
                rendered="#{empty from}">
                <f:param name="questaoId"
                        value="#{_questao.id}"/>
            </p:link>
        </p:column>
    </p:dataTable>

    </div>
    </p:panel>

    <div class="tableControl">

        <p:link outcome="/pages/QuestaoList.xhtml"
            rendered="#{questaoList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </p:link>

        <p:link outcome="/pages/QuestaoList.xhtml"
            rendered="#{questaoList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{questaoList.previousFirstResult}"/>
        </p:link>

        <p:link outcome="/pages/QuestaoList.xhtml"
            rendered="#{questaoList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{questaoList.nextFirstResult}"/>
        </p:link>

        <p:link outcome="/pages/QuestaoList.xhtml"
            rendered="#{questaoList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{questaoList.lastFirstResult}"/>
        </p:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <p:button outcome="/pages/QuestaoEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Create questao">
            <f:param name="questaoId"/>
        </p:button>
    </s:div>

</ui:define>

</ui:composition>
